﻿

namespace CarTrackr.Business.Validation 
{
    public class AboveZeroRule : Rule
    {

        public override RuleType Type
        {
            get
            {
                return RuleType.AboveZero;
            }
        }

        public override string Text
        {
            get
            {
                return PropertyName + " should be specified.";
            }
        }

        public override bool Validate(string value)
        {
            decimal result;

            if (decimal.TryParse(value,out result))
            {
                if(result>=0) return true;
            }

            return false; 
        }

    }
}
